package com.errol.batchprocessor.payroll.advisor.upload;

import com.renjia.service.module.payroll.advisor.AbstractPayrollAdvisor;
import com.renjia.service.module.payroll.advisorimpl.payload.PayrollUploadBatchPayload;
import com.renjia.service.module.payroll.advisorimpl.payload.PayrollUploadSinglePayload;
import org.springframework.lang.NonNull;

/**
 * 发放导入上传阶段扩展
 *
 * @author zhang xiao bin
 * @version v1.0
 * @date 2021/02/09
 * @since v5.0.6
 **/
public interface PayrollUploadCreateAdvisor extends AbstractPayrollAdvisor {

    /**
     * 上传费用单阶段，创建 PayrollRecord 之后，保存 PayrollRecord 之前执行
     *
     * @param batchPayload 批次数据
     * @return true 表示执行成功，false 表示执行失败，拦截
     */
    boolean doAfterNewPayrollRecordAtUploadStage(@NonNull PayrollUploadBatchPayload batchPayload);

    /**
     * 上传费用单阶段，创建 PayrollRecordDetail 之后，保存 PayrollRecordDetail 之前执行
     *
     * @param singlePayload 单条数据
     * @param batchPayload  批次数据
     * @return true 表示执行成功，false 表示执行失败，拦截
     */
    boolean doAfterNewPayrollDetailAtUploadStage(@NonNull PayrollUploadSinglePayload singlePayload, @NonNull PayrollUploadBatchPayload batchPayload);

    /**
     * 编辑发放明细之前执行，对批次和明细进行必要的重置，然后重新走导入流程
     *
     * @param singlePayload 单条数据
     * @param batchPayload  批次数据
     * @return true 表示执行成功，false 表示执行失败，拦截
     */
    boolean doBeforeModifyPayrollDetailAtUploadStage(@NonNull PayrollUploadSinglePayload singlePayload, @NonNull PayrollUploadBatchPayload batchPayload);
}
